﻿#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
using namespace std;

// 类模板 
template<class T>
class Father {
public:
	Father() {
		this->a = 20;
	}
	Father(T t) :a(t) {}
public:
	T a; 
};

// 普通类继承类模板，需要指定泛型类型 
class Son : public Father<int> {
public:

};

// 类模板继承类模板，也需要指定泛型类型  
template <class T1, class T2>
class Son2 : public Father<T2> {
public:
	T1 b;
	Son2(T1 t1, T2 t2) :Father<T2>(t2), b(t1) {}
	void Print() {
		cout << "a=" << Father<T2>::a << ",b=" << b << endl;
	}
};

void test01() {
	Son2<int, string> s2(1,"hello");
	s2.Print();
}

int main()
{

	test01(); 

	system("pause");
	return EXIT_SUCCESS;
}